<template>
    <div>
        <h1 @click="router.push('/ts')">typeScript</h1>
        <hr>
        <div v-if="route.name">
            <h3 @click="router.push('/ts/types')">数据类型</h3>
            <h3 @click="router.push('/ts/assertion')">数据断言</h3>
            <h3 @click="router.push('/ts/interface')">接口</h3>
            <h3 @click="router.push('/ts/class')">类</h3>
            <h3 @click="router.push('/ts/get_set')">存取器</h3>
            <h3 @click="router.push('/ts/static')">静态成员</h3>
            <h3 @click="router.push('/ts/vue3')">vue3 中定义变量</h3>
        </div>
        <router-view></router-view>
    </div>
</template>

<script lang="ts">
import { defineComponent, getCurrentInstance, ref } from "vue";
import router from "../../router/index";
import { useRoute } from "vue-router";
export default defineComponent({
    name: "TS_index111",
    setup() {
        const route = useRoute();
        const { ctx } = getCurrentInstance() as any; //获取上下文实例，ctx=vue2的this
        console.log(ctx.$route);
        return {
            router,
            route,
        };
    },
});
</script>
